#coding: utf-8

'''
Person具有的基本属性：姓名、年龄、性别、籍贯
'''
class Person(object):

    def __init__(self, name, age, sex, birthPlace):
        # 所有的属性都设置为私有
        self.__name = name
        self.__age = age
        self.__sex = sex
        self.__birthPlace = birthPlace

    def get_name(self):
        return self.__name

    def get_age(self):
        return self.__age

    def get_sex(self):
        return self.__sex

    def get_birthPlace(self):
        return self.__birthPlace

    def print_self(self):
        return 'name: ' + self.get_name() \
               + '\nage:' + str(self.get_age()) \
               + '\nsex: ' + self.get_sex() \
               + '\nbirthPlace: ' + self.get_birthPlace()


'''
Student继承自Person，额外的属性为:学号、学院、专业、密码
'''
class Student(Person):

    def __init__(self, name, age, sex, birthPlace, id, college, major, password):
        self.__id = id
        self.__college = college
        self.__major = major
        self.__password = password
        Person.__init__(self, name, age, sex, birthPlace)

    def get_id(self):
        return self.__id

    def get_college(self):
        return self.__college

    def get_major(self):
        return self.__major

    def get_password(self):
        return self.__password

    def print_self(self):
        return Person.print_self(self) \
               + '\nid: ' + str(self.get_id()) \
               + '\ncollege: ' + self.get_college() \
               + '\nmajor: ' + self.get_major()

'''
Test
'''
if __name__ == '__main__':
    stu = Student("liulinfeng", '23', "man", "BeiJing", "10001", "Computer", "Computer Science", "123456")
    print(stu.print_self())
